<template>
  <div class="content" style="height: 99%;">
    <div class="second-menu">
      <ul class="second-ul">
        <li
          v-for="(name,index) in menuName"
          :key="name"
          @click="changeType(index)"
          :class="{true:'active'}[menuIndex===index]"
        >{{name}}</li>
      </ul>
    </div>
    <!--section1-->
    <div
      class="section section1 clearfix"
      v-if="menuIndex===0"
      v-loading="loading"
      element-loading-text="拼命加载中"
      element-loading-spinner="el-icon-loading"
      element-loading-background="rgba(0, 0, 0, 0.5)"
    >
      <div class="screen-search">
        <div class="screen">
          <span>筛选</span>
          <ul class="screen-ul" style="font-family:'微软雅黑';">
            <li :class="{true:'active'}[cplbIndex===-1]" @click="searchAll()">
              <a href="javascript:void(0)">全部</a>
            </li>
            <li
                v-for="(cuisineLb,index) in cuisineLbList"
                :key="index"
                :class="{true:'active'}[cplbIndex===index]"
                @click="searchLb(cuisineLb.id,index)"
            >
              <a href="javascript:void(0)">{{cuisineLb.name}}</a>
            </li>
          </ul>
        </div>
        <div class="search-group">
            <span class="search-group-addon" @click="searchCp(input)">
            <img src="../../assets/img/search.png">
            </span>
            <input type="text" placeholder="操作人" id="search" v-model="input">
            <!-- <el-input id="search" placeholder="请输入内容" v-model="input" clearable></el-input> -->
        </div>
      </div>
      <waterfall
        class="cuisine"
        :line-gap="280"
        :watch="cuisineList"
        style="overflow: scroll;height:85%;"
        >
        <waterfall-slot
          class="cuisine-box"
          v-for="(item,index) in cuisineList"
          :key="index"
          :width="250"
          :height="270"
          :order="index"
        >
          <div class="cuisine-item" @click='handleChooseCuiItem(index,item.id)' :class="{true:'ChoosedCuiItem'}[chooseCuiItem.indexOf(item.id) > -1]">
            <div class="cuisine-item-top">
              <!-- <AliImage :keys="item.tp" style="border-radius: 6px 6px 0 0;"></AliImage> -->
              <img class="item-pic" v-lazy="imgUrl + item.picture" style="height: 200px;width: 260px;border-radius: 6px 6px 0 0;"/> 
               <div class="trade-name">品名：{{item.mc}}</div>
            </div>
            <div class="cuisine-item-bottom">
              <div class="type-price">
                <span class="type">车型：{{item.type.name}}</span>
             
              </div>
              <div class="introduce" v-if="item.bz">简介:{{item.bz}}</div>
              <div class="switch-div" style="margin-top: 10px;">
                <span>是否可预订</span>
                  <el-switch
                    v-model="item.sfsy"
                    active-color="#8ba8fe"
                    inactive-color="#a5a5a5"
                    @click.native.stop="handelUpdate(item.id,item.sfsy)"
                  ></el-switch>
              </div>
            </div>
          </div>
        </waterfall-slot>
        <!-- <waterfall-slot class="cuisine-box">
                        <div class="cuisine-item">
                            <a href="#" class="cptj"><img src="../../assets/img/cptj.png" width="100%" height="100%"></a>
                        </div>
        </waterfall-slot>-->
      </waterfall>

      <div class="bottom-ope clearfix">
        <div class="left-btn">
          <!-- <el-checkbox v-model="allChecked" class="checkBox" style="margin:0 20px;color:#77a6fe!important; ">全选</el-checkbox> -->
          <button class="btn btn-tjcp" @click="addCp()">添加车辆</button>
          <button class="btn btn-sc" @click="deleteCp()">删除</button>
        </div>
        <ul
          class="paging"
          style="position: absolute;right: 20px;top: 50%;transform: translateY(-14px);"
        >
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page.sync="currentPage"
            background
            :page-size="rows"
            :page-sizes="[10, 15, 20, 25]"
            layout="sizes,total,prev, pager, next, jumper"
            :total="total"
          ></el-pagination>
        </ul>
      </div>
    </div>
    <!--section2-->
    <div class="section section3 clearfix" v-if="menuIndex===1"       v-loading="loading"
      element-loading-text="拼命加载中"
      element-loading-spinner="el-icon-loading"
      element-loading-background="rgba(0, 0, 0, 0.5)">
        <div class="content xfjl">
             <div class="screen-search">
        <div class="screen">
          <span>筛选</span>
          <ul class="screen-ul" style="font-family:'微软雅黑';">
            <!-- <li :class="{true:'active'}[searchIndex===-1]">
              <a href="javascript:void(0)">全部</a>
            </li> -->
            <li
                v-for="(cuisineLb,index) in searchList"
                :key="index"
                :class="{true:'active'}[searchIndex===index]"
                @click="searchDd(index)"
            >
              <a href="javascript:void(0)">{{cuisineLb}}</a>
            </li>
          </ul>
        </div>
        <div class="search-group">
            <span class="search-group-addon" @click="searchInfo(input,searchIndex)">
            <img src="../../assets/img/search.png">
            </span>
            <input type="text" placeholder="搜索" id="search" v-model="input">
            <!-- <el-input id="search" placeholder="请输入内容" v-model="input" clearable></el-input> -->
        </div>
      </div>
            <div class="table-box" style="max-height: 700px;overflow-y: scroll;">
            <el-table
            ref="multipleTable"
            :data="orderList"
            tooltip-effect="dark"
            style="width:100%;"
            stripe
            @selection-change="handleSelectionChange">
                <el-table-column  
                    width="55">
                </el-table-column>

                <el-table-column
                    prop="ddbh"
                    label="订单号"
                    width="130"
                    show-overflow-tooltip>
                </el-table-column>
                    <el-table-column
                    prop="ydr"
                    label="预订人"
                    width="80">
                </el-table-column>
                <el-table-column
                    prop="phone"
                    label="手机号码"
                    show-overflow-tooltip>
                </el-table-column>
                 <el-table-column
                    prop='cjsj'
                    label="下单时间"
                    show-overflow-tooltip>
                </el-table-column>
                  <el-table-column
                    prop='sffp'
                    label="发票信息"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column
                    prop='fkfs'
                    label="支付方式"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column
                    prop='ddzt'
                    label="状态"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column
                    fixed="right"
                    label="操作"
                    :key='orderList' 
                    width="100">
                    <template slot-scope="scope">
                        <el-button @click="findByDdbh(scope.row.ddbh)" type="text" size="small">查看</el-button>
                        <el-button @click="handleDriver(scope.row.yyjs,scope.row.yyjsreturn,scope.row.singleordoubble,scope.row.id)" type="text" size="small" v-if='scope.row.ddzt=="未派单"'>派单</el-button>
                        <el-button @click="handleOrder(scope.row.id)" type="text" size="small" v-if='scope.row.ddzt=="已派单"'>完单</el-button>
                    </template>
                </el-table-column>
                <el-table-column
                    fixed="right"
                    label="取消预订"
                    :key='orderList' 
                    width="100">
                    <template slot-scope="scope">
                        <el-button @click="deleteOrder(scope.row.id)" type="text" size="small" v-if='scope.row.ddzt=="未派单"'>取消预订</el-button>
                    </template>
                </el-table-column>
            </el-table>
            </div>
            <div class="bottom-ope clearfix">
                <div class="left-btn">
                    <!-- <input type="checkbox" class="allCheckbox"> -->
                    <!-- <span>全选</span> -->
                    <!-- <button class="btn btn-export">导出</button> -->
                </div>
                <ul
                class="paging"
                style="position: absolute;right: 20px;top: 50%;transform: translateY(-14px);"
                >
                <el-pagination
                @size-change="handleOrderSizeChange"
                @current-change="handleOrderCurrentChange"
                :current-page.sync="currentOrderPage"
                background
                :page-size="orderRows"
                :page-sizes="[10, 15, 20, 25]"
                layout="sizes,total,prev, pager, next, jumper"
                :total="orderTotal"
                ></el-pagination>
                </ul>
            </div>
        </div>
    </div>

    <!--section3-->
    <div class="section section3 clearfix" v-if="menuIndex===2"    v-loading="loading"
      element-loading-text="拼命加载中"
      element-loading-spinner="el-icon-loading"
      element-loading-background="rgba(0, 0, 0, 0.5)">
        <div class="content xfjl">
            <!-- <div class="screen-search">
                <div class="screen">
                    <span>筛选</span>
                    <ul class="screen-ul">
                        <li class="active"><a href="#">全部</a></li>
                        <li><a href="#">时间</a></li>
                        <li><a href="#">房型</a></li>
                        <li><a href="#">状态</a></li>
                    </ul>
                </div>
            </div> -->
            <div class="table-box" style="max-height: 700px;overflow-y: scroll;">
            <el-table
            ref="multipleTable"
            :data="allDriverList"
            tooltip-effect="dark"
            style="width:100%;"
            stripe
            @selection-change="handleSelectionChange"
            >
                <el-table-column
                    prop="ry.xm"
                    label="姓名"
                    show-overflow-tooltip>
                </el-table-column>
                    <el-table-column
                    prop="ry.sjhm"
                    label="手机号码"
                >
                </el-table-column>

                <el-table-column
                    prop="gz"
                    label="车型"
                >
                </el-table-column>
                <el-table-column
                    fixed="right"
                    label="操作"
                    :key='allDriverList' 
                    width="100">
                    <template slot-scope="scope">
                        <el-button @click="editDriver(scope.row.id)" type="text" size="small">修改</el-button>
                        <el-button @click="deleteDriver(scope.row.id)" type="text" size="small">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            </div>
            <div class="bottom-ope clearfix">
                <div class="left-btn">
                    <!-- <input type="checkbox" class="allCheckbox"> -->
                    <!-- <span>全选</span> -->
                    <button class="btn btn-export" @click="addDriver()">添加</button>
                </div>
                <ul
                class="paging"
                style="position: absolute;right: 20px;top: 50%;transform: translateY(-14px);"
                >
                <el-pagination
                @size-change="handleOrderSizeChange2"
                @current-change="handleOrderCurrentChange2"
                :current-page.sync="currentOrderPage2"
                background
                :page-size="orderRows2"
                :page-sizes="[10, 15, 20, 25]"
                layout="sizes,total,prev, pager, next, jumper"
                :total="orderTotal2"
                ></el-pagination>
                </ul>
            </div>
        </div>
    </div>

    <!--section4-->
    <div class="section section3 clearfix" v-if="menuIndex===3"       v-loading="loading"
      element-loading-text="拼命加载中"
      element-loading-spinner="el-icon-loading"
      element-loading-background="rgba(0, 0, 0, 0.5)">
        <div class="content xfjl">
            <div class="table-box" style="max-height: 700px;overflow-y: scroll;">
            <el-table
            ref="multipleTable"
            :data="applyPageList"
            tooltip-effect="dark"
            style="width:100%;"
            stripe
            @selection-change="handleSelectionChange">
                <el-table-column
                    align="center"
                    prop="applyName"
                    label="姓名"
                    width="120"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column
                    align="center"
                    prop="driverId.ry.sjhm"
                    label="手机号"
                    width="120">
                </el-table-column>
                <el-table-column
                    prop="kssj"
                    align="center"
                    label="开始日期"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column
                    align="center"
                    prop="jssj"
                    label="结束日期"
                    show-overflow-tooltip>
                </el-table-column>
                 <el-table-column
                    prop='reason'
                    align="center"
                    label="申请原因"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column
                    prop='applyRecord'
                    label="审批记录"
                     align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column
                    prop='applyStatus'
                    label="状态"
                    align="center"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column
                    fixed="right"
                    label="操作"
                    align="center"
                    width="130"
                    :key='applyPageList' 
                    >
                    <template slot-scope="scope">
                        <el-button @click="allowApply(scope.row.id,'通过')" type="text" size="small" v-if="scope.row.applyStatus=='不通过'">通过</el-button>
                        <el-button @click="allowApply(scope.row.id,'不通过')" type="text" size="small"  v-if="scope.row.applyStatus=='通过'" >不通过</el-button>
                    </template>
                </el-table-column>
            </el-table>
            </div>
            <div class="bottom-ope clearfix">
                <div class="left-btn">
                    <!-- <input type="checkbox" class="allCheckbox"> -->
                    <!-- <span>全选</span> -->
                    <!-- <button class="btn btn-export">导出</button> -->
                </div>
                <ul
                class="paging"
                style="position: absolute;right: 20px;top: 50%;transform: translateY(-14px);"
                >
                <el-pagination
                @size-change="handleOrderSizeChange3"
                @current-change="handleOrderCurrentChange3"
                :current-page.sync="currentOrderPage3"
                background
                :page-size="orderRows3"
                :page-sizes="[10, 15, 20, 25]"
                layout="sizes,total,prev, pager, next, jumper"
                :total="orderTotal"
                ></el-pagination>
                </ul>
            </div>
        </div>
    </div>


    <!--提示信息框 添加车辆start-->
    <div class="modal" id="modal" :class="{true:'modal-in'}[showModel]">
      <div class="modal-title">
        <div class="title">添加车辆</div>
        <a href="javascript:void(0);" class="close" @click="modalClose()">
          <img src="../../assets/img/close.png">
        </a>
      </div>
      <div class="modal-content">
        <el-form
          ref="form"
          label-width="80px"
          :model="form"
          :hide-required-asterisk="true"
          :rules="rules"
        >
          <el-upload
            class="avatar-uploader"
            :action="attachImg"
            :on-success="handleSuccess"
            name="myfiles"
            list-type="picture-card"
            :multiple="false"
            :before-upload="beforeUpload"
            :show-file-list="false"
          >
            <img
              v-if="dialogImageUrl"
              :src="dialogImageUrl"
              class="avatar"
              style="max-width: 144px;"
            >
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>

          <el-form-item label="车辆名称" :required="true" prop="mc">
            <el-input v-model="form.mc"></el-input>
          </el-form-item>

        <el-form-item label="车型" >
            <el-input placeholder="请输入添加车型名称" v-model="csType" clearable class="input-with-select">
                <el-button slot="append" icon="el-icon-check" @click="saveCpType(csType)"></el-button>
            </el-input>
        </el-form-item>

          <el-form-item label="车型" prop="typeId">
            <el-select placeholder="请选择车型" v-model="form.typeId">
              <el-option
                v-for="item in cuisineLbList"
                :key="item.name"
                :label="item.name"
                :value="item.id"
                style="padding-left: 10px;"
              ></el-option>
            </el-select>
            <el-tooltip class="item" effect="dark" content="删除此车型" placement="top"  v-if="form.typeId">
                <el-button type="danger" icon="el-icon-delete" circle size="mini" v-if="form.typeId" @click='deleteType(form.typeId)'></el-button>
            </el-tooltip>
          </el-form-item>

          <!-- <el-form-item label="商品简介">
            <el-input type="textarea" v-model="form.bz"></el-input>
          </el-form-item> -->

          <el-form-item>
                <el-button type="primary" class="btn btn-makeSure" @click="save(form)">确定</el-button>
          </el-form-item>
          <!-- <button class="btn btn-makeSure" @click="save(form)">确定</button> -->
        </el-form>
      </div>
    </div>
    <div class="modal-backdrop" :class="{true:'modal-in modal-backdrop-active'}[showModel]"></div>
    <!--提示信息框 添加车辆end-->

    <!--提示信息框 添加车辆start-->
    <div class="modal" id="modal" :class="{true:'modal-in'}[showAddModel]">
      <div class="modal-title">
        <div class="title">导入商品</div>
        <a href="javascript:void(0);" class="close" @click="modalClose()">
          <img src="../../assets/img/close.png">
        </a>
      </div>
      <div class="modal-content" style="width: 400px;min-height:125px;">
        <el-upload v-if='active==0'
        class="upload-demo"
        :multiple="true"
        action="${pageContext.request.contextPath}/lookup/editEvidence/123"
        :auto-upload="false"
        :http-request="uploadFile"
        ref="upload"
        >
            <el-button size="small" type="primary" style="height: 33px; width: 90px;margin-bottom: 14px;">选择图片</el-button>
            <div slot="tip" class="el-upload__tip">只能上传jpg/png文件</div>
            <!-- <el-button style="margin-left: 10px;" size="small" type="success" @click="subPicForm">上传到服务器</el-button> -->
        </el-upload>

        <el-upload v-if='active==1'
        class="upload-demo"
        :multiple="false"
        action="${pageContext.request.contextPath}/lookup/editEvidence/123"
        :auto-upload="false"
        :http-request="uploadExcel"
        ref="upload2"
        >
            <el-button size="small" type="primary" style="height: 33px; width: 90px;margin-bottom: 14px;">选择文件</el-button>
            <!-- <el-button style="margin-left: 10px;" size="small" type="success" @click="subPicExcel">上传到服务器</el-button> -->
        </el-upload>
        <div @click='download()' v-if='active==1' style="cursor: pointer;">下载模板</div>

         <el-button style="margin-top: 40px;height: 45px;width: 90px;" @click="subPicForm" v-if='active===0'>下一步</el-button>
        <el-button style="margin-top: 40px;height: 45px;width: 90px;" @click="subPicExcel" v-if='active===1'>下一步</el-button>
          <!-- <button class="btn btn-makeSure" @click="save(form)">确定</button> -->

      </div>
    </div>
    <div class="modal-backdrop" :class="{true:'modal-in modal-backdrop-active'}[showAddModel]"></div>
    <!--提示信息框 添加车辆end-->

    <!--提示信息框 查询司机start-->
    <div class="modal" id="modal" :class="{true:'modal-in'}[showDriverModel]" style="width: 25%;"> 
      <div class="modal-title">
        <div class="title">指派司机</div>
        <a href="javascript:void(0);" class="close" @click="modalClose1()">
          <img src="../../assets/img/close.png">
        </a>
      </div>
      <div class="modal-content" style="width:90%;;min-height:125px;">
            <el-select
            v-model="selectDriver"
            multiple
            collapse-tags
            style="margin-left:20px;"
            @change="handleSelect($event)"
            placeholder="请选择">
                <el-option
                v-for="item in driverList"
                :key="item.id"
                :label="item.ry.xm"
                :value="item.id">
                </el-option>
        </el-select>
        <el-button type="primary" class="btn btn-makeSure" @click="setDriver(form)" style="margin-top: 30px;">指派</el-button>
      </div>
    </div>
    <div class="modal-backdrop" :class="{true:'modal-in modal-backdrop-active'}[showDriverModel]"></div>
    <!--提示信息框 查询司机end-->

    <!--提示信息框 通过和不通过-->
    <div class="modal" id="modal" :class="{true:'modal-in'}[dialogFormVisible]" style="width: 25%;"> 
      <div class="modal-title">
        <div class="title">审批意见</div>
        <a href="javascript:void(0);" class="close" @click="modalClose()">
          <img src="../../assets/img/close.png">
        </a>
      </div>
      <div class="modal-content" style="width:90%;;min-height:125px;">
            <el-form ref="form" :model="applyListForm" label-width="80px">
                <el-form-item label="审批意见">
                    <el-input v-model="applyListForm.applyRecord"></el-input>
                </el-form-item>
            </el-form>
        <el-button type="primary" class="btn btn-makeSure" @click="suballowApply(form)" style="margin-top: 30px;">提交</el-button>
      </div>
    </div>
    <div class="modal-backdrop" :class="{true:'modal-in modal-backdrop-active'}[dialogFormVisible]"></div>

    <!--提示信息框 添加司机start-->
    <div class="modal" id="modal" :class="{true:'modal-in'}[showAddDriver]" style="width: 30%;"> 
      <div class="modal-title">
        <div class="title">添加司机</div>
        <a href="javascript:void(0);" class="close" @click="modalClose()">
          <img src="../../assets/img/close.png">
        </a>
      </div>
      <div class="modal-content" style="width:90%;;min-height:125px;">
        <el-form ref="form" :model="addDriverForm" label-width="80px">
            <el-form-item label="姓名">
              <el-autocomplete
                v-model="addDriverForm.xm"
                :fetch-suggestions="querySearchAsync"
                placeholder="请点击选择需要添加的司机"
                @select="handleSearchSelect"
                ></el-autocomplete>
            </el-form-item>

            <!-- <el-form-item label="姓名" prop="xm">
            <el-select placeholder="请选择司机" v-model="addDriverForm.xm">
              <el-option
                v-for="item in xmList"
                :key="xmList[item].xm"
                :label="xmList[item].xm"
                :value="xmList[item].xm"
                style="padding-left: 10px;"
              ></el-option>
            </el-select>
            </el-form-item> -->
            <!-- <el-form-item label="联系方式">
              <el-autocomplete
                v-model="addDriverForm.xm"
                :fetch-suggestions="querySearchAsync"
                placeholder="请输入内容"
                @select="handleSearchSelect"
                ></el-autocomplete>
            </el-form-item> -->
            
            <el-form-item label="车型" prop="gz">
            <el-select placeholder="请选择车型" v-model="addDriverForm.gz">
              <el-option
                v-for="item in cuisineLbList"
                :key="item.name"
                :label="item.name"
                :value="item.name"
                style="padding-left: 10px;"
              ></el-option>
            </el-select>
            </el-form-item>
        </el-form>
        <el-button type="primary" class="btn btn-makeSure" @click="setAddDriver(form)" style="margin-top: 30px;">确认</el-button>
      </div>
    </div>
    <div class="modal-backdrop" :class="{true:'modal-in modal-backdrop-active'}[showAddDriver]"></div>
    <!--提示信息框 添加司机end-->

    <!--提示信息框 订单详情start-->
    <div class="modal" id="modal" :class="{true:'modal-in'}[showDetailModel]"  style="width:65%;">
      <div class="modal-title">
        <div class="title">订单详情</div>
        <a href="javascript:void(0);" class="close" @click="modalClose()">
          <img src="../../assets/img/close.png">
        </a>
      </div>
      <div class="modal-content" style="min-height:125px;">
          <div class="invoice" v-if='invoiceDetail!=null'>
            <div class="ddbh" style="border-bottom: 1px solid #77a6fe;width: 100%;display: block;text-align: left;padding-bottom: 10px;">
                  <span>发票详情 </span>
            </div>
            <div class="form" style="margin-bottom">
                <el-form label-position="left" inline class="demo-table-expand" :model="invoiceDetail" v-if='invoiceDetail!=null'>
                    <el-form-item label="发票名字" style="text-align: left;">
                    <span>{{ invoiceDetailname }}</span>
                    </el-form-item>
                    <el-form-item label="发票抬头"  style="text-align: left;">
                    <span>{{ invoiceDetail.invoiceTitle }}</span>
                    </el-form-item>
                    <el-form-item label="发票种类"  style="text-align: left;">
                    <span>{{ invoiceDetail.invoiceType}}</span>
                    </el-form-item>
                    <el-form-item label="发票号"  style="text-align: left;" v-if='invoiceDetail.taxIdNum'>
                    <span>{{invoiceDetail.taxIdNum}}</span>
                    </el-form-item>
                </el-form>
            </div>
          </div>

          
          <div class="orderDetail" v-if='orderDetail' style="margin-top: 20px;">
              <div class="ddbh" style="border-bottom: 1px solid #77a6fe;width: 100%;display: block;text-align: left;padding-bottom: 10px;">
                  <span>订单详情 </span>
              </div>
              <div>
                <el-form label-position="left" inline class="demo-table-expand" :model="orderDetail" v-if='orderDetail!=null'>
                    <el-form-item label="订单编号" style="text-align: left;">
                        <span>{{ orderDetail.ddbh }}</span>
                    </el-form-item>
                    <el-form-item label="订单起点"  style="text-align: left;">
                        <span>{{ orderDetail.startpoint }}</span>
                    </el-form-item>
                    <el-form-item label="订单终点"  style="text-align: left;">
                        <span>{{ orderDetail.endpoint }}</span>
                    </el-form-item>       
                    <el-form-item label="是否往返"  style="text-align: left;">
                        <span>{{ orderDetail.singleordoubble }}</span>
                    </el-form-item>
                    <el-form-item label="起始时间"  style="text-align: left;" v-if=' orderDetail.yyjs '>
                        <span>{{ orderDetail.yyjs | dateFmt}}</span>
                    </el-form-item>
                    <el-form-item label="结束时间"  style="text-align: left;" v-if=' orderDetail.yyjsreturn '>
                        <span>{{ orderDetail.yyjsreturn }}</span>
                    </el-form-item>
                    <el-form-item label="司机姓名" style="text-align: left;" v-if=' orderDetail.names '>
                        <span>{{ orderDetail.names }}</span>
                    </el-form-item>
                    <el-form-item label="司机电话"  style="text-align: left;" v-if=' orderDetail.phones '>
                        <span>{{ orderDetail.phones }}</span>
                    </el-form-item>
                </el-form>
              </div>
          </div>

      </div>
    </div>
    <div class="modal-backdrop" :class="{true:'modal-in modal-backdrop-active'}[showDetailModel]"></div>
    <!--提示信息框 订单详情end-->

        <!--提示信息框 添加司机start-->
    <div class="modal" id="modal" :class="{true:'modal-in'}[showEditDriver]" style="width: 30%;"> 
      <div class="modal-title">
        <div class="title">修改</div>
        <a href="javascript:void(0);" class="close" @click="modalClose()">
          <img src="../../assets/img/close.png">
        </a>
      </div>
      <div class="modal-content" style="width:90%;;min-height:125px;">
        <el-form ref="form" :model="addDriverForm" label-width="80px">
            <el-form-item label="车型" prop="gz">
            <el-select placeholder="请选择车型" v-model="addDriverForm.gz">
              <el-option
                v-for="item in cuisineLbList"
                :key="item.name"
                :label="item.name"
                :value="item.name"
                style="padding-left: 10px;"
              ></el-option>
            </el-select>
            </el-form-item>


        </el-form>
        <el-button type="primary" class="btn btn-makeSure" @click="subEditDriver(form)" style="margin-top: 30px;">修改</el-button>
      </div>
    </div>
    <div class="modal-backdrop" :class="{true:'modal-in modal-backdrop-active'}[showEditDriver]"></div>
    <!--提示信息框 添加司机end-->
    <div class="section section3 clearfix" v-if="menuIndex===4">
      <div class="search-group">
        <span class="search-group-addon" @click="searchCp(input)">
          <img src="../../assets/img/search.png">
        </span>
        <input type="text" placeholder="搜索" id="search" v-model="input">
        <!-- <el-input id="search" placeholder="请输入内容" v-model="input" clearable></el-input> -->
      </div>
      <div class="table-box" style="max-height: 700px;overflow-y: scroll;width:100%;">
        <el-table
          ref="multipleTable"
          :data="logList"
          tooltip-effect="dark"
          style="width:100%;"
          stripe
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="index" label="序号" width="180" show-overflow-tooltip></el-table-column>
          <el-table-column prop="cjr" label="创建人id" width="180" show-overflow-tooltip></el-table-column>
          <el-table-column prop="cjsj" label="创建时间" width="180" show-overflow-tooltip></el-table-column>
          <el-table-column prop="gxsj"  label="更新时间" show-overflow-tooltip></el-table-column>
          <el-table-column prop="userid" label="用户id" show-overflow-tooltip></el-table-column>
          <el-table-column prop="username" label="操作人" show-overflow-tooltip></el-table-column>
          <el-table-column prop="operate" label="操作" show-overflow-tooltip></el-table-column>
        </el-table>
      </div>
      <ul
        class="paging"
        style="position: absolute;right: 50px;top:100%;transform: translateY(-14px);"
      >
        <el-pagination
          @size-change="handleLogSizeChange"
          @current-change="handleLogCurrentChange"
          :current-page.sync="currentOrderPage"
          background
          :page-size="orderRows"
          :page-sizes="[10, 15, 20, 25]"
          layout="sizes,total,prev, pager, next, jumper"
          :total="orderTotal"
        ></el-pagination>
      </ul>
    </div>

  </div>
</template>

<script src="./template.js"></script>
<script>
import auth from "../../api/auth";
import clyd from '../../api/clyd'
import { mapGetters, mapActions } from "vuex";
import Waterfall from "vue-waterfall/lib/waterfall";
import WaterfallSlot from "vue-waterfall/lib/waterfall-slot";
import AliImage from "../../components/Image";
import {
  setLocalStorage,
  isQuotaExceeded,
  getLocalStorage
} from "../../helpers/locTime";
import setDate from "../../helpers/setDate"
import axios from "axios";
import Date from "../../components/date.vue";
import querystring from 'querystring'

export default {
  name: "Clyd",
  props: ["currentMarketTreenode"],
  components: {
    Waterfall,
    WaterfallSlot,
    AliImage,
    Date
  },
  data() {
    return {
        menuName: ["车辆管理","车辆调度","司机管理","司机调度审核","日志管理"],
        csType:null,
        logList: [
        {
          index: "",
          cjr: "",
          cjsj: "",
          gxsj: "",
          userid: "",
          username: "",

          operate: ""
        }
      ],
  csType: null,
  sineList: [],
   cuisineList: [],
        cuisineLbList: [],
        sfkyd: true,
        allChecked:false,
        currentPage: 1,
        rows: 10,
        menuIndex: 0,
        searchList:['预订人','手机号码'],
        searchIndex:0,
        cplbIndex: -1,
        shopList: this.$parent.shopList,
        form: {
            mc: "",
            typeId: "",
            picture: "",
        },
        Treenode: this.currentMarketTreenode,
        dialogImageUrl: "",
        cuisineLb: "",
        input: "",
        total: null,
        loading: false,
        showModel: false,
        showAddModel:false,
        attachImg:axios.defaults.baseURL + "clyd/app/cs/filesUpload?_token=" + getLocalStorage("token"),
         multipleTablep: {},
        rules: {
            name: [
            { required: true, message: "请输入车辆名称", trigger: "blur" },
            { min: 2, max: 7, message: "长度在 2 到 7 个字符", trigger: "blur" }
            ],
            typeId: [{ required: true, message: "请选择车型", trigger: "change" }]
        },
         total: null,
      totalLog: null,
      rows: 10,
      currentPage: 1,
      orderList: [],
      logList: [],
      roomIndex: -1,
      roomC: {}, //选择房间的索引,
      checkList: [],
      imgList: [],
      active: 0,
      currentOrderPage: 1,
      orderRows: 10,
      multipleSelection: [],
      orderTotal: null,
        rules2: {
            mc: [
                { required: true, message: "请输入包厢名称", trigger: "blur" },
                { min: 2, max: 7, message: "长度在 2 到 7 个字符", trigger: "blur" }
            ],rnrs: [{ required: true, message: "请选择容纳人数", trigger: "blur" }],
        },// 
        chooseCuiItem:[],
        isLoad : [],
        imgUrl:axios.defaults.baseURL + 'clyd/upload/',
        //以上是第一模块data
        imgList:[],
        active: 0,
        currentOrderPage: 1,
        orderRows:10,
        orderList:[],
        multipleSelection:[],
        orderTotal:null,
        orderTotal2:null,
        orderTotal3:null,
        orderDetail:null,
        invoiceDetail:null,
        goodDetailList:[],
        showDriverModel:false,
        driverOrderId:null,
        showDetailModel:false,
        //以上是第二模块
        currentOrderPage2: 1,
        orderRows2:10,
        driverList:[],
        selectDriver: [],
        dialogFormVisible:false,
        applyListForm:{
            applyId:null,
            applyRecord:null,
            applyStatus:null
        },
        allDriverList:[],
        showAddDriver:false,
        showEditDriver:false,
        addDriverFormxm:null,
        addDriverForm:{
            gz:null
        },
        //以上是第三模块
        currentOrderPage3: 1,
        orderRows3:10,
        applyPageList:[],
        xmList:[]
    };
  },
  created() {
    // this.form.refe = this.treeNode
    this.onGetList();
     this.gettableDate();
    console.log(this.Treenode,this.form.refe);
  },
   mounted(){
  this.getdate("1472048779952")
  },
  methods: {
    ...mapActions(["getGrxx", "login"]),
    imageLoaded(index){
        console.log('图片已加载',index)
        // this.isLoad = true
    },
    getOrderList() {
      console.log("a");
      this.loading = true;
      clyd
        .findOrderList(this.currentPage, this.rows, this.currentHotelTreenode)
        .then(res => {
          if (res.success) {
            this.loading = false;
            console.log(res.data.list);
            this.orderList = res.data.list;
            console.log(this.orderList);
            this.total = res.data.size;
          }
        });
    },
    gettableDate() {
      this.loading = true;
      clyd
        .selectLogs(
          this.currentOrderPage,
          this.orderRows,
          this.username,
          this.hotelMc
        )
        .then(res => {
          if (res.success) {
            this.loading = false;
            this.logList = res.data.pageList;
            console.log(this.logList)
            this.totalLog = res.data.total;
            //    console.log( "时间"+this.getdate(res.data.pageList.cjsj))
                // console.log(this.getdate("1472048779952"))
            
            // this.logList.forEach(function(item,i){
            //     console.log(this.getdate("1472048779952"))
            // })
          }
        });
    },
     handleSizeChange(val) {
      this.rows = val;
      this.getOrderList();
      this.gettableDate();
    }, //分页插件 size变化
     handleCurrentChange(val) {
      this.getOrderList();
      this.gettableDate();
    }, //分页插件
     handleLogSizeChange(val) {
      this.orderRows = val;
      this.gettableDate();
    }, //分页插件 size变化
     handleLogCurrentChange(val) {
      this.gettableDate();
    }, //分页插件
     handleSelectionChange(val) {
      this.multipleSelection = val;
      for (var item in this.multipleSelection) {
        console.log(this.multipleSelection[item].id);
      }
    },
    searchCp(val) {
      if (!val) {
        this.$message.error("输入内容不可为空");
      } else {
        clyd.selectLogs(1, 10, val).then(res => {
          if (res.success) {
            console.log(res.data.pageList);
            this.logList = res.data.pageList;
            this.totalLog = res.data.total;
          }
        });
      } // 查询请求入口
    },

     deleteOrder(orderId){
                 this.$confirm('是否取消预订?', '警告', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    clyd.clqx(orderId).then(res=>{
                        console.log(res)
                         if(res.success){
                            this.$message({
                                type: 'success',
                                message: '取消成功!'
                            });
                            this.findOrder();
                        }else{
                            this.$message.error('出现问题,请重新操作!')
                        }
                    }).catch(()=>{
                        this.$message.error('出现问题,请重新操作!')
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消操作'
                    });          
                });
            },//取消预订
    deleteCp(){
        if(this.chooseCuiItem.length ===0 ){
            this.$message({
                    type: 'warning',
                    message: '没有选中任何车辆'
            });
        }else{
            this.$confirm('此操作将删除所选文件, 是否确认?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                clyd.deleteByCarsId(this.chooseCuiItem).then(res=>{
                    console.log(res)
                    if(res.success){
                        this.searchAll()
                        this.$message({
                            type: 'success',
                            message: '删除成功!'
                        });
                    }
                }).catch(() => {
                    this.$message({
                    type: 'error',
                    message: '该车辆被引用无法删除'
                });          
            });
            }).catch(() => {
                this.$message({
                type: 'info',
                message: '已取消删除'
                });          
            });
        }
    },//删除商品

    handleChooseCuiItem(index,id){
        if(this.chooseCuiItem.indexOf(id) === -1){
            this.chooseCuiItem.push(id)
        }else{
            this.chooseCuiItem.splice(this.chooseCuiItem.indexOf(id),1)
        }
    },//选择商品

    handelUpdate(id,sfkyd){
        console.log("1")
        console.log(id,sfkyd)
        let type = null
        if(sfkyd){
            type = 1
        }else{
            type = 0
        }
        clyd.isCarOrderUpdate(id,type).then(res=>{
              console.log("2")
            console.log(res)
            if(res.success){
                this.$message({
                    type: 'success',
                    message: '更改成功!'
                });
            }else{
                this.$message({
                    type: 'info',
                    message: '更改失败!'
                });   
            }
        })
    },//更改是否预订状态
    
    handleSizeChange(val) {
      this.rows = val;
        this.gettableDate();
      this.onGetList();
    },//分页插件 size变化

    handleCurrentChange(val) {
      this.onGetList();
       this.gettableDate();
    },//分页插件

    handleSuccess(res, file) {
      console.log(res, file);
      this.dialogImageUrl = axios.defaults.baseURL + "clyd/upload/" + res.data.list.replace(',','');
      this.form.picture = res.data.list.replace(',','');
    },//图片上传成功回调

    beforeUpload(file) {
      const isJPG = file.type === "image/jpeg";
      const isPNG = file.type === "image/png";
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isJPG && !isPNG) {
        this.$message.error("上传头像图片只能是 JPG/PNG 格式!");
      }
      if (!isLt2M) {
        this.$message.error("上传头像图片大小不能超过 2MB!");
      }
      return (isJPG || isPNG) && isLt2M;
    },//图片格式检测函数

    save(form) {
        console.log(this.form.refe)
        this.$refs.form.validate(valid => {
            if (valid) {
            clyd.saveCar(this.form).then(res => {
                console.log(res);
                if (res.success) {
                this.$message.success("添加成功!");
                this.searchAll();
                this.showModel = false;
                }
            });
            } else {
            console.log("error submit!!");
            return false;
            }
        });
    },//保存商品

    addCp() {
      this.showModel = true;
    },//添加车辆按钮

    modalClose() {
      this.showModel = false
      this.showAddModel = false
      this.showDetailModel = false
      this.showDriverModel = false
      this.dialogFormVisible=false
      this.showAddDriver = false
      this.showEditDriver = false
      this.addDriverForm.ry = null
    },//关闭商品model
    modalClose1() {
      this.showDriverModel = false
    },//关闭商品model

    changeType(index) {
      this.menuIndex = index;
      if(index==1){
          this.findOrder()//第三模块执行
      }else if(index==2){
          this.findDriverList()
      }else if (index==3){
          this.findapplyPageList()
      }
    },//calss动态变化
    changeType(index) {
      this.menuIndex = index;
      console.log(index);
      if (index == 4) {
        this.gettableDate();
        console.log(this.orderList);
      }
    },

    onGetList(typeId=null,name) {
      this.loading = true;
      clyd.getList(this.currentPage, this.rows,typeId,name).then(res => {
           //商品list
          this.cuisineList = []
          setTimeout(()=>{
            this.cuisineList = res.data.carsList;
            console.log(this.cuisineList)
          },300) //图片不刷新的暂时解决办法 哎...
          if (this.currentPage === 1) {
            this.cuisineLbList = res.data.typeList; //分类
          }
          this.total = res.data.total; //总数
          this.loading = false; //载入动画
          //this.$forceUpdate()//强制刷新
          console.log(this.cuisineList)
        });
    },//获取首页的商品全部信息

    searchLb(cplbId, index) {
      this.loading = true;
      //存在每次查完仍然有商品类别 所以要重新写cygl.getList
      clyd
        .getList(this.currentPage, this.rows,cplbId)
        .then(res => {
          this.cuisineList = res.data.carsList; //商品list
          this.total = res.data.total;
          this.loading = false;
        });
      this.cplbIndex = index;
    },//搜索类别

    searchCp(val) {
      if (!val) {
        this.$message.error("输入内容不可为空");
      } else {
        this.onGetList(null,val);
      }
    },//搜索商品
    searchAll() {
      this.loading = true;
      this.cplbIndex = -1;
      this.onGetList();
    //this.$forceUpdate()//强制刷新
    },//搜索全部
    
    //以上是第一模块method--------------------------
    importCp(){
        this.active=0//初始化步骤条
        this.showAddModel=true
    },

    uploadFile(file){
        console.log(file)
        this.formDate.append('myfiles', file.file);
        console.log(this.formDate)
        this.subPicForm(file)
    },
    subPicForm(param){
        this.formDate = new FormData()
        this.$refs.upload.submit();
        console.log( this.formDate)
        clyd.uploadImg(
        this.formDate,
        function(event){
            param.file.percent = event.loaded/event.total*100
            param.onProgress(param.file)
        }).then(res=>{
            console.log(res)
            param.data.list.push({
                name:res.data.name,
                status:"success",
                uid:new Date().getTime(),
                url:res.data.url
            })

            if(res.data.list){
                this.imgList = res.data.list
                this.active = 1 //关闭这一步
                this.$refs.upload.clearFiles() //上传成功后清空文件列表
                this.$message.success('图片上传成功,请进行下一步')
            }else{
                this.$message({
                    type: 'warning',
                    message: '您没有选中任何图片啊'
            }   );
            }
        })
    },

    uploadExcel(excel){
        this.formexcel.append('file', excel.file);
        // form.append('list', this.imgList);
        console.log(this.formexcel)
      
    },
    subPicExcel(){
        this.formexcel = new FormData()
        this.formexcel.append('list', this.imgList);
        this.$refs.upload2.submit();
        console.log(this.formexcel)
        clyd.importCP(this.formexcel).then(res=>{
            if(res.success){
                console.log(res)
                this.active = 0
                this.$refs.upload2.clearFiles()//上传成功后清空文件列表
                this.showAddModel = false
                this.onGetList();//刷新本页面
                this.$message.success('导入文件成功!')
            }else{
                this.$message.error('操作失败,请重新操作')
            }
        }).catch(res=>{
            this.$message.error('操作失败,请检查上传文件格式!')
        })
    },

    next(){
        if (this.active++ > 1) this.active = 0;
        console.log(this.active)
    },
    download(){
        window.open(axios.defaults.baseURL + 'clyd/app/cs/download'+'?_token=' + getLocalStorage('token'))
        console.log(getLocalStorage('token'))
    },
    saveCpType(mc){
        if(mc==null){
            return   
        }else{
                clyd.saveType(mc).then(res=>{
                if(res.success){
                    this.$message.success("添加车辆类型成功!");
                    this.onGetList();
                }
            })
        }
    },
    deleteType(id){
        console.log(id)
        this.$confirm('此操作将删除该类型, 是否确认?', '警告', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                clyd.deleteType(id).then(res=>{
                    console.log(res)
                    if(res.success){
                        this.$message({
                            type: 'success',
                            message: '删除成功!'
                        });
                        this.form.cplb = null //删除完了 要去掉选择的值
                        this.showModel=false
                        this.onGetList()
                    }else{
                        this.$message.error('该商品已被引用,无法删除!')
                    }
                }).catch(()=>{
                    this.$message.error('该商品已被引用,无法删除!')
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                });          
            });
    },
    //以上是section2//////////////////////////////////////////////
     searchDd(index){
      this.searchIndex=index;
    },
     searchInfo(input){
      console.log(input)
      console.log(this.searchIndex)
        clyd.pageOrderList(this.currentOrderPage,this.orderRows,null,input,this.searchIndex).then(res=>{
            console.log(res)
            this.orderTotal = res.data.total
            res.data.orderList.content.forEach((item,index)=>{
                this.loading=false
                switch(item.ddzt){
                    case 'YPD':
                        item.ddzt = '已派单'
                        break;
                    case 'YWJ':
                        item.ddzt = '未派单'
                        break;
                    case 'YWC':
                        item.ddzt = '已完成'
                    break;
                }
                switch(item.fkfs){
                    case 'XJ':
                        item.fkfs = '到店付款'
                        break;
                    case 'WX':
                        item.fkfs = '微信付款'
                        break;
                    case 'JZ':
                        item.fkfs = '记账支付'
                    break;  
                    case null:
                        item.fkfs = '未付款'
                    break;  
                }

                item.cjsj = setDate(item.cjsj,'-')

                if(item.sffp){
                    item.sffp = '有'
                }else{
                    item.sffp = '无'
                }
            })  
            this.orderList = res.data.orderList.content
        })
    },
    findOrder(){
        this.loading = true
        clyd.pageOrderList(this.currentOrderPage,this.orderRows).then(res=>{
            console.log(res)
            this.orderTotal = res.data.total
            res.data.orderList.content.forEach((item,index)=>{
                this.loading=false
                switch(item.ddzt){
                    case 'YPD':
                        item.ddzt = '已派单'
                        break;
                    case 'YWJ':
                        item.ddzt = '未派单'
                        break;
                    case 'YWC':
                        item.ddzt = '已完成'
                    break;
                }
                switch(item.fkfs){
                    case 'XJ':
                        item.fkfs = '到店付款'
                        break;
                    case 'WX':
                        item.fkfs = '微信付款'
                        break;
                    case 'JZ':
                        item.fkfs = '记账支付'
                    break;  
                    case null:
                        item.fkfs = '未付款'
                    break;  
                }

                item.cjsj = setDate(item.cjsj,'-')

                if(item.sffp){
                    item.sffp = '有'
                }else{
                    item.sffp = '无'
                }
            })  
            this.orderList = res.data.orderList.content
        })
    },
    handleOrderSizeChange(val){
        this.orderRows = val;
        this.findOrder();
        this.getOrderList();
      this.gettableDate();
    },
    handleOrderCurrentChange(){
        this.findOrder();
        this.getOrderList();
      this.gettableDate();
    },
    handleSelectionChange(val) {
        this.multipleSelection = val;
    },
    openDetailModel(){
        this.showDetailModel = true
    },
    findGoodsInfoList(orderId,invoiceId){
        this.openDetailModel()
        this.loading=true
        clyd.findGoodsInfoList(orderId,invoiceId).then(res=>{
            this.loading=false
            console.log(res)
            this.goodDetail = res.data.invoice
            this.goodDetailList = res.data.orderList
            this.goodDetailList.forEach(item=>{
                item.zje = ((item.price*10000) * (item.count*10000) )/10000
            })
        })
    },
    handleDriver(time1,time2,flag,id){   
        this.showDriverModel = true
        this.driverOrderId = id
        clyd.driver(time1,time2,flag).then(res=>{
            console.log(res)
            this.driverList = res.data.list
            console.log(this.driverList)
            // for(var key in this.driverList){
            //     console.log(this.driverList[key].ry.xm)
            // }
        })
    },
    handleOrder(orderId){//设置完单
         this.$confirm('此操作将设置订单状态为完单, 是否确认?', '警告', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                clyd.wg(orderId).then(res=>{
                    console.log(res)
                    if(res.success){
                        this.$message({
                            type: 'success',
                            message: '设置成功!'
                        });
                        this.findOrder()
                    }else{
                        this.$message.error('出现问题')
                    }
                }).catch(()=>{
                    this.$message.error('出现问题!')
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消操作'
                });          
            });
    },
    handleSelect(event){
        console.log(event,this.selectDriver)
    },
    allowApply(id,status){
        this.dialogFormVisible = true
        this.applyListForm.applyId = id 
        this.applyListForm.applyStatus=status
      
    },
    suballowApply(){
        clyd.allowApply(this.applyListForm).then(res=>{
            if(res.success){
                 this.$message({
                    type: 'success',
                    message: '提交成功'
                });      
                this.dialogFormVisible=false
                this.findOrder()
                this.findapplyPageList();
            }else{
                 this.$message({
                    type: 'error',
                    message: '提交失败'
                });      
            }
        })
    },
    setDriver(){
        if(this.selectDriver.length==0){
            this.$message({
                    type: 'error',
                    message: '司机不能为空'
            });   
        }else{
            console.log(this.driverOrderId,this.selectDriver)
            console.log(this.driverOrderId,this.selectDriver.join('000'))
            clyd.setDriver(91,"50006").then(res=>{
                if(res.success){
                    this.$message({
                        type: 'success',
                        message: '指派成功'
                    });
                    this.showDriverModel=false;
                    this.findOrder()   
                }else{

                     this.$message({
                        type: 'error',
                        message: '指派失败'
                    });
                }
            })
        }
        this.showDriverModel=false;
    },
    findByDdbh(ddbh){
        clyd.findByDdbh(ddbh).then(res=>{
            this.showDetailModel=true
            this.invoiceDetail = res.data.order.invoice
            this.orderDetail = res.data.order
            console.log(this.orderDetail)
            // this.orderDetail.yyjs = setDate(this.orderDetail.yyjs,'-')
            console.log(this.orderDetail.yyjs)
            if( this.orderDetail.yyjsreturn!=null){
                    this.orderDetail.yyjsreturn = setDate(this.orderDetail.yyjsreturn,'-')
            }
     
        })
        
    },
    //---------------------------以上是第二模块

    findDriverList(){
        this.loading = true
        clyd.findDriverList(this.currentOrderPage2,this.orderRows).then(res=>{
            console.log(res)
            this.loading = false
            this.orderTotal2 = res.data.total
            
            this.allDriverList = res.data.driverList
            
        })
    },
    handleOrderSizeChange2(val){
        this.orderRows2 = val;
        this.findDriverList();
        this.getOrderList();
      this.gettableDate();
    },
    handleOrderCurrentChange2(){
        this.findDriverList();
        this.getOrderList();
      this.gettableDate();
    },
    handleSelectionChange2(val) {
        this.multipleSelection = val;
    },
    addDriver(id){
        this.showAddDriver = true
         console.log(this.allDriverList)
        
    },
    querySearchAsync(queryString, callback){
        var list = [{}]
        console.log(queryString)
        clyd.selectJZG(1,10,queryString).then(res=>{
          this.xmList=res.data.list;
          console.log(this.xmList)
            for(let i of res.data.list){
                i.value = i.xm; 
            }
            callback(res.data.list)
        })
    },
    handleSearchSelect(item){   
        this.addDriverForm.ry = item.id
    },  
    setAddDriver(){
        if(this.addDriverForm.ry==null && this.addDriverForm.gz==null ){
            this.$message({
                    type: 'error',
                    message: '内容不能为空'
            });
        }else{
            this.showAddDriver=false
            console.log(this.addDriverForm);
            console.log(querystring);
            clyd.saveDriver(this.addDriverForm).then(res=>{
                if(res.success){
                    this.$message({
                        type: 'success',
                        message: '添加成功'
                    });
                    this.findDriverList()
                    this.addDriverForm.ry==null
                    this.addDriverForm.gz==null
                }
            })
        }
    },
    editDriver(id){
        this.showEditDriver=true
        this.addDriverForm.id = id
    },
    subEditDriver(){
        clyd.saveDriver(this.addDriverForm).then(res=>{
            if(res.success){
                this.$message({
                    type: 'success',
                    message: '修改成功'
                });
                this.findDriverList()
                this.showEditDriver=false
                this.addDriverForm={}
                this.addDriverForm.gz = null
            }
        })
    },
    deleteDriver(id){
         this.$confirm('此操作将删除所选司机, 是否确认?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                clyd.deleteDriver(id).then(res=>{
                    console.log(res)
                    if(res.success){
                        this.findDriverList()
                        this.$message({
                            type: 'success',
                            message: '删除成功!'
                        });
                    }
                }).catch(() => {
                    this.$message({
                    type: 'error',
                    message: '删除失败'
                });          
            });
            }).catch(() => {
                this.$message({
                type: 'info',
                message: '已取消删除'
                });          
            });
    },
    //以上是第三模块------------------------------------------
    findapplyPageList(){
        this.loading = true
        clyd.applyPageList1(this.currentOrderPage3,this.orderRows3).then(res=>{
            console.log(res)
            this.loading=false
            this.orderTotal3 = res.data.total
            res.data.list.forEach(item=>{
                item.kssj = setDate(item.kssj,"-")
                item.jssj = setDate(item.jssj,"-")
            })
            this.applyPageList = res.data.list
        })
    },
    handleOrderSizeChange3(val){
        this.orderRows3 = val;
        this.findDriverList();
        this.getOrderList();
      this.gettableDate();
    },
    handleOrderCurrentChange3(){
        this.findDriverList();
         this.getOrderList();
      this.gettableDate();
    },
    handleSelectionChange3(val) {
        this.multipleSelection = val;
    },
    
  


  },
  computed: {},
  watch:{ //可以使用字符串 对 data中的对象属性进行监听
      cuisineLbList : ()=>{
           this.gettableDate();
        // console.log('cuisineLbList数据发生变化')
      },
      allChecked:{
            handler(newVal){
                if(newVal){
                    this.cuisineList.forEach(item=>{
                        this.chooseCuiItem.push(item.id)
                    })
                }else{
                    this.chooseCuiItem=[]
                }
            },   
            deep: true
        }//深度监听allChecked 即可访问data的值

  }
};
</script>



<style scoped lang="less" src="./template.less"></style>
<style lang="less" scoped>

</style>
